package com.zou.practice.callback;

/**
 * 回调业务避免循环依赖
 *
 * @author zouyaowen
 * @date 2020-08-19
 */
public class ListenerImpl implements Listener {

    private Broadcaster broadcaster;

    public ListenerImpl(Broadcaster b) {
        broadcaster = b;
        b.register(this);
    }

    @Override
    public void callBack(Object arg) {
        //回调业务
    }

    public void shutDown() {
        broadcaster.unregister(this);
    }
}